package com.example.exp_4_javaweb;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/loginresult")
public class LoginResult extends HttpServlet {

    @Override
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=UTF-8");

        Student student = (Student) request.getAttribute("student");
        boolean isAccountRight = (Boolean) request.getAttribute("isAccountRight");

        if (isAccountRight) {
            response.sendRedirect("main.jsp");
        } else {
            response.getWriter().println("登陆失败！");
        }
    }
}
